package com.tiancheng.onecode.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.tiancheng.onecode.entity.Bill;
import com.tiancheng.onecode.entity.MemberSubOrder;
import com.tiancheng.onecode.model.request.admin.QueryBillReq;
import com.tiancheng.onecode.model.request.admin.StatisticsMerchantOrderReq;
import com.tiancheng.onecode.model.response.PageInfo;
import com.tiancheng.onecode.model.response.admin.BillQueryRes;
import com.tiancheng.onecode.model.response.admin.StatisticsMerchantOrderPayRes;
import com.tiancheng.onecode.model.response.admin.TradeStatisticsRes;
import com.tiancheng.onecode.trade.enums.MessageTypeEnum;
import com.tiancheng.onecode.trade.notify.CallbackSettleMsgBO;

import java.util.List;

/**
 * @Author: kellen
 * @Description: 账单 service
 * @Date: create in 2024/12/17 15:44
 */
public interface IBillService extends IService<Bill> {
    /**
     * 支付通知创建账单，支付成功后触发
     *
     * @param orderId 主订单信息
     * @return
     */
    Boolean createAfterPay(String orderId);

    /**
     * 添加账单明细项，退款成功后触发
     *
     * @param refundId  退款id
     * @param subOrders 子订单列表
     * @return
     */
    Boolean createAfterRefund(String refundId, List<MemberSubOrder> subOrders);

    /**
     * 账单完成
     *
     * @return
     */
    Boolean CompleteBill();

    /**
     * 分页列表
     *
     * @param params
     * @return
     */
    PageInfo<BillQueryRes> queryPage(QueryBillReq params);

    /**
     * 交易统计
     *
     * @param platformMerchantId
     * @return
     */
    TradeStatisticsRes tradeStatistics(Long platformMerchantId);

    /**
     * 清分统计-按天
     *
     * @param params
     * @return
     */
    List<StatisticsMerchantOrderPayRes> statisticsByDay(StatisticsMerchantOrderReq params);

    /**
     * 结算结果通知
     * @param settleMsgBO 通知内容
     * @param msgType 消息：支付结算、退款结算
     * @return
     */
    boolean settleResultHandler(CallbackSettleMsgBO settleMsgBO, MessageTypeEnum msgType);
}
